Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added EXTRA_FLAGS variable to CUDA Makefile to provide the freedom to… #28

Merged
merged 3 commits into from
Mar 17, 2017

Conversation

psteinb
Copy link

@psteinb psteinb commented Mar 13, 2017

… specify debug flags or gencode flags,

in more detail, I ran into trouble when trying to benchmark more than arraysize = 32*1024*1024. This is due to the fact that by default, not -gencode flags or similar are setup for the nvcc call of the cuda GPU stream. This defaults to an SM that doesn't support an arraysize of this magnitude and hence the init_arrays fails with error code 0xb Invalid arguments. We had the discussion about gencodes before in #8, but the new Makefile based build system doesn't reflect the outcome of #8.

@tomdeakin
Copy link
Contributor

tomdeakin commented Mar 13, 2017

You don't need to predefine EXTRA_FLAGS in the Makefile for this to work. You can just specify the gencode at the command line with no changes:

make -f CUDA.make EXTRA_FLAGS="-g -gencode=<...>"

@psteinb
Copy link
Author

psteinb commented Mar 13, 2017 via email

@tomdeakin
Copy link
Contributor

That's true. Are you able to put the -O3 flag in CXXFLAGS instead of EXTRA_FLAGS to be consistent with the other Makefiles, e.g OpenMP.make?

@psteinb
Copy link
Author

psteinb commented Mar 13, 2017 via email

@tomdeakin
Copy link
Contributor

What flexibility are you seeing with ?=? If you override any variables on the CLI then Make still uses this user defined one and ignores all the assignments with = in the Makefile.

@psteinb
Copy link
Author

psteinb commented Mar 13, 2017 via email

@jrprice
Copy link
Contributor

jrprice commented Mar 13, 2017

Sure, but the same is true without the ?. e.g. if the Makefile looks like this:

CXXFLAGS=-std=c++11 -O3

cuda-stream: main.cpp CUDAStream.cu
        nvcc ${CXXFLAGS} -DCUDA $^ $(EXTRA_FLAGS) -o $@

You can still override CXXFLAGS like this:

make -f CUDA.cmake CXXFLAGS="-g -G -std=c++11"

@psteinb
Copy link
Author

psteinb commented Mar 13, 2017 via email

@psteinb
Copy link
Author

psteinb commented Mar 17, 2017

we didn't come to a conclusion on this, did we?

@tomdeakin
Copy link
Contributor

Thanks for your investigation into = vs ?= - we'd not realised the implication of this before. I think we will want to move all the Makefiles to using ?= instead of = so that it doesn't matter what position in the command line the variables are.

But for the purposes of this pull request, can you pull out the -O3 flag to CXXFLAGS but use an = for now. We can go though and update all the Makefiles consistently to ?= later.

make variable to cope with clang as CUDA compiler as well
@psteinb
Copy link
Author

psteinb commented Mar 17, 2017

done

@tomdeakin tomdeakin merged commit bf57cf5 into UoB-HPC:master Mar 17, 2017
@tomdeakin
Copy link
Contributor

Merged, thanks for the contribution.

@tomdeakin
Copy link
Contributor

Created Issue #30 for switching to ?=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants